<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class ModifyStepprojectAddcolumnIstestqualisty extends AbstractMigration
{
    public function up()
    {
        $this->table("step_project")
            ->addColumn('is_validate', 'enum', ['null' => false, 'comment' => '是否进行质检', "values" => 'no,yes', 'default' => 'no', 'after' => 'is_manual_submit'])
            ->save();
    }

    public function down()
    {    
        $column1 = $this->table("step_project")->hasColumn('is_test_quality');
        $column2 = $this->table("step_project")->hasColumn('is_validate');
        if ($column1) {
            $this->table("step_project")
                ->removeColumn('is_test_quality')
                ->save();
        }
        if ($column2) {
            $this->table("step_project")
                ->removeColumn('is_validate')
                ->save();
        }
    }
}